﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Text;
using System.Security.Cryptography;

namespace Maticsoft
{
    /// <summary>
    ///Common 的摘要说明
    /// </summary>
    public class Common
    {
        public static string ReturnValue(bool isSuccess, string msg)
        {
            return "{'success':" + isSuccess.ToString().ToLower() + ",'msg':'" + msg.ToString() + "'}";
        }

        public static string Md5Encrypts(string str)
        {

            str = str + "synjones";
            string md5Str = string.Empty;
            byte[] inputData = Encoding.UTF8.GetBytes(str);
            byte[] md5Data = MD5.Create().ComputeHash(inputData);
            for (int i = 0; i < md5Data.Length; i++)
            {
                md5Str += md5Data[i].ToString("X").PadLeft(2, '0');
            }
            return md5Str;
        }
    }
    public class Query
    {
        private String _name = "";
        private String _type = "";
        private DateTime _from = DateTime.MinValue;
        private DateTime _to = DateTime.MaxValue;
        public String name
        {
            set { _name = value; }
            get { return _name; }
        }
        public String type
        {
            set { _type = value; }
            get { return _type; }
        }
        public DateTime from
        {
            set { _from = value; }
            get { return _from; }
        }
        public DateTime to
        {
            set { _to = value; }
            get { return _to; }
        }
    }

}